package J2ME_LoverTest;

import java.io.IOException;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;

public class WelcomeCanvas extends GameCanvas implements CommandListener{
    private LoverTestMIDlet ltm;
    private Command cmdExit=new Command("Exit",Command.EXIT,1);
    private Command cmdEnterGameChoose=new Command("Enter",Command.SCREEN,1);
    private Graphics gc;
    private Image Welcom;
    
    
	
	protected WelcomeCanvas(LoverTestMIDlet ltm) {
		super(true);
		this.ltm=ltm;
		this.addCommand(cmdEnterGameChoose);
		this.addCommand(cmdExit);
		this.setCommandListener(this);
		gc=this.getGraphics();
		try {
			Welcom=Image.createImage("/Welcome.png");
		} catch (IOException e) {
			
			e.printStackTrace();
		}
		gc.drawImage(Welcom, 0, 0, 0);
		
		
		
		
	}

	public void commandAction(Command c, Displayable d) {
		
		if(c==cmdExit){
			ltm.notifyDestroyed();
		}
		else if(c==cmdEnterGameChoose){
			ltm.changeInterface("ChoiceHostList");
			
		}
		
	}
	
	

}
